n = int(input())
ls = list(map(int,input().split()))
ls.sort()
ls.pop(0)
ls.pop()
score_sum = sum(i for i in ls)
score = score_sum / (n - 2)
print(f'{score:.2f}')
